﻿
@{
    ViewData["Title"] = "用户管理";
    Layout = "~/Views/Shared/_LayuiTableEdit.cshtml";
}
<form id="searchForm" onsubmit="return false;">
    <div class="layui-input-inline">
        <input class="layui-input search_input" placeholder="请输入关键字" name="searchValue" autocomplete="off">
    </div>
    <div class="layui-input-inline">
        <a class="layui-btn layui-btn-normal" onclick="tableReload()">搜索</a>
    </div>
    <div class="layui-inline">
        <button type="reset" class="layui-btn layui-btn-danger">重置</button>
    </div>
</form>
<script type="text/html" id="tableBar">
    <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>
<script type="text/html" id="isManageTpl">
    {{#  if(d.IsManage == true ){ }}
    <span style="color: #F581B1;">是</span>
    {{#  } else { }}
    否
    {{#  } }}
</script>
<table class="layui-table" lay-data="{url:'@ViewBag.ListUrl',height: 'full-200', method: 'post',page:true, id:'mainTable',limits: [5, 10, 20, 50, 100]}" lay-filter="demo">
    <thead>
        <tr>
            <th lay-data="{type:'numbers'}"></th>
            <th lay-data="{field:'UserName',width:100}">用户名</th>
            <th lay-data="{field:'MobileNumber',width:150}">手机号</th>
            <th lay-data="{field:'LoginName',width:100}">登陆名</th>
            <th lay-data="{field:'LoginCount',width:90}">登陆次数</th>
            <th lay-data="{field:'RoleName',width:120}">角色</th>
            <th lay-data="{field:'OnLineLoginNumber',width:120}">在线数量</th>
            <th lay-data="{field:'IsManage', align:'center',templet: '#isManageTpl',width:100}">管理账户</th>            
            <th lay-data="{fixed: 'right', width:150, align:'center', toolbar: '#tableBar'}"></th>
        </tr>
    </thead>
</table>
<button class="layui-btn" onclick="add()">新增</button>
<script>
    restEditModel = function (data) {
        data.IsManage = data.IsManage.toString(); // data.IsManage ? "true" : "false";        
        return data;
    }
</script>